package com.church.services;

import java.util.List;

import com.church.dao.MusicDao;
import com.church.db.Music;

public class MusicServicesImpl implements MusicServices {
	private MusicDao musicDao;
	
	public MusicDao getMusicDao() {
		return musicDao;
	}

	public void setMusicDao(MusicDao musicDao) {
		this.musicDao = musicDao;
	}

	public String add(Music music) {
		return musicDao.add(music);
	}

	public String update(Music music) {
		return musicDao.update(music);
	}


	public String remove(Music music) {
		Music musicTemp = musicDao.findById(music.getId());
		if(musicTemp!=null)
		{
			musicTemp.setState("3");
			return musicDao.update(musicTemp);
		}
		return "error";
	}


	public Music findById(long id) {
		return musicDao.findById(id);
	}


	public Music findByName(String name) {
		return musicDao.findByName(name);
	}


	public List<Music> getList() {
		return musicDao.getList();
	}

}
